package com.jzx.provider.cv.service;

import com.hankcs.hanlp.dictionary.CustomDictionary;
import com.jzx.provider.cv.model.KeyWork;
import com.jzx.provider.cv.model.Major;
import com.jzx.provider.cv.repository.KeyWordRepository;
import com.jzx.provider.cv.repository.MajorRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MajorService {
    @Autowired
    private MajorRepository majorRepository;

    public void createDir() {
        for (int i = 1; i < 1000; i++) {
            List<Major> majors = majorRepository.findByPage((i - 1) * 100, 100);
            if (majors == null || majors.size() == 0) {
                return;
            }
            majors.forEach(major -> {
                CustomDictionary.insert(major.getName(), major.getType() + " " + major.getWeight());
            });
        }
    }
}
